<ResourceDictionary 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:ui="clr-namespace:Bookvar.UI"
    >

	<DataTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ui:ResourceItem},ResourceId=IconResourceItem}">
		<Image Source="{Binding ItemSource}" />
	</DataTemplate>

	<DataTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ui:ResourceItem},ResourceId=ImageResourceItem}">
		<Image Source="{Binding ItemSource}" Stretch="Fill" />
	</DataTemplate>

	<DataTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ui:ResourceItem},ResourceId=VideoResourceItem}">
		<Viewbox Stretch="Fill">
			<ui:VideoPlayer Source="{Binding ItemSource}" Width="320" Height="240" />
		</Viewbox>
	</DataTemplate>

	<Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ui:ResourceItem},ResourceId=ResourceItemStyleKey}" TargetType="{x:Type ui:ResourceItem}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Margin" Value="5" />
		<Setter Property="Width" Value="{Binding VisualSize.Width, Mode=TwoWay}" />
		<Setter Property="Height" Value="{Binding VisualSize.Height, Mode=TwoWay}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ui:ResourceItem}">
					<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					<ControlTemplate.Triggers>
						<!-- Change IsSelected SelectedBackgroundBrush to set the selection color for the items -->
						<!--<Trigger Property="IsSelected" Value="true">
							<Setter Property="Background" Value="{DynamicResource SelectedBackgroundBrush}" TargetName="Border"/>
						</Trigger>-->
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>